package utils

import (
	"go-bluebell/model"

	"github.com/gin-gonic/gin"
)

// GetCurrentUserID 获取当前登录的用户ID

func GetCurrentUserID(c *gin.Context) (userID int64, err error) {
	uid, ok := c.Get(model.CtxUserIDKey)
	if !ok {
		err = model.ErrorUserNotLogin
		return
	}
	userID, ok = uid.(int64)
	if !ok {
		err = model.ErrorUserNotLogin
		return
	}
	return
}
